package com.axin.system.api;

import com.axin.common.core.constant.ServiceNameConstants;
import com.axin.common.core.domain.web.AjaxResult;
import com.axin.system.api.config.FeignConfiguration;
import com.axin.system.api.domain.SysUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 用户服务 远程调用
 *
 * @Author axin
 * @Date 2021/9/11 23:15
 */
@FeignClient(
        contextId = "remoteUserService",
        value = ServiceNameConstants.SYSTEM_SERVICE,
        path = "/user",
        configuration = FeignConfiguration.class)
public interface RemoteUserService {

    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @return 结果
     */
    @GetMapping("/info/{username}")
    AjaxResult<SysUser> selectUserByUserName(@PathVariable("username") String username);

    /**
     * 记录登录信息
     * @param user
     * @return
     */
    @PostMapping("/updateUserProfile")
    AjaxResult updateUserProfile(@RequestBody SysUser user);
}
